package com.dk.mq;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dk.service.es.EsService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = "es",consumerGroup = "consumer-es")
public class EsRocketMqConsumer implements RocketMQListener<Object> {
    @Reference
    private EsService esService;
    @Override
    public void onMessage(Object o) {
        Long id = (Long) o;
        System.out.println("es消费成功"+id);
        esService.saveEs(id);
    }
}
